package com.kmust.dream.wanderingdream.donation.service.impl;

import com.kmust.dream.wanderingdream.comm.utils.PageUtils;
import com.kmust.dream.wanderingdream.comm.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.kmust.dream.wanderingdream.donation.dao.OthersInformationDonationDao;
import com.kmust.dream.wanderingdream.donation.entity.OthersInformationDonationEntity;
import com.kmust.dream.wanderingdream.donation.service.OthersInformationDonationService;


@Service("othersInformationDonationService")
public class OthersInformationDonationServiceImpl extends ServiceImpl<OthersInformationDonationDao, OthersInformationDonationEntity> implements OthersInformationDonationService {
    @Autowired
    OthersInformationDonationDao othersInformationDonationDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<OthersInformationDonationEntity> page = this.page(
                new Query<OthersInformationDonationEntity>().getPage(params),
                new QueryWrapper<OthersInformationDonationEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public String getTextByRId(String rid) {
        return othersInformationDonationDao.getTextByRId(rid);
    }

    @Override
    public OthersInformationDonationEntity getByRId(String rid) {
        QueryWrapper<OthersInformationDonationEntity> query = new QueryWrapper<>();
        query.eq("recipient_id",rid);
        OthersInformationDonationEntity re = othersInformationDonationDao.selectOne(query);
        return re;
    }

}